#ifndef UPDATEINFO_H
#define UPDATEINFO_H

#include <QObject>
#include <QXmlStreamReader>
#include <QXmlStreamWriter>
#include <iostream>
#include <QFile>

class UpdateInfo : public QObject
{
    Q_OBJECT
public:
    explicit UpdateInfo(QObject *parent = nullptr);
    ~UpdateInfo();

    bool SaveInfoToXml(const QString &fileName = "update.xml");
    bool ReadInfoFromXml(const QString &fileName = "update.xml");

    void print();

    void setPort(const int &port);
    int getPort();

    void setIp(const QString &ip);
    QString getIp();

    void setVersion(const QString &version);
    QString getVersion();

    void setUpdateDate(const QString &date);
    QString getUpdateDate();

    QList <QString> fileNameList;

signals:

public slots:

private:
    void readNetwork();
    void readFileInfo();

    bool checkData(const QString &data);

private:
    int port;
    QString ip;
    QString version;
    QString updateDate;

    QFile * _fileUpdate;
    QXmlStreamReader xmlReader;
    QXmlStreamWriter xmlWriter;
};

#endif // UPDATEINFO_H
